import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'account _security_page.dart';
import 'blacklist_page.dart';
import 'notification _settings_page.dart';

/*
*
*
* 我的---设置
*
* */

class SetUpPage extends StatefulWidget {
  const SetUpPage({Key key}) : super(key: key);

  @override
  _SetUpPageState createState() => _SetUpPageState();
}

class _SetUpPageState extends State<SetUpPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        leading: IconButton(
          icon: Icon(Icons.arrow_back_ios, color: Colors.black),
          onPressed: () {
            ///界面返回
            Navigator.of(context).pop();
            print("返回");
          },
        ),
        backgroundColor: Colors.white,
        elevation: 1,
        title: Text(
          "设置",
          style: TextStyle(fontSize: 18, color: Color.fromRGBO(17, 17, 17, 1)),
        ),
      ),
      body: Column(
        children: <Widget>[
          //账户与安全
          accountsAndSecurity(),
          //黑名单
          blackList(),
          Container(
            height: 12,
            color: Color.fromRGBO(243, 243, 243, 1),
          ),

          //通知设置
          notificationSettings(),
          //清除缓存
          clearCache(),
          Container(
            height: 12,
            color: Color.fromRGBO(243, 243, 243, 1),
          ),
          //退出登录
          logOut(),
        ],
      ),
    );
  }

  ///账户与安全
  Widget accountsAndSecurity() {
    return GestureDetector(
      onTap: () {
        print("----------------------账户与安全--------------------");
        Navigator.push(context, MaterialPageRoute(builder: (context) {
          return AccountSecurityPage();
        }));
      },
      child: Container(
        width: MediaQuery.of(context).size.width - 32,
        height: 48,
        margin: EdgeInsets.only(left: 16, right: 16, top: 12),
        child: Row(
          children: <Widget>[
            Text(
              "账户与安全",
              style:
                  TextStyle(fontSize: 16, color: Color.fromRGBO(17, 17, 17, 1)),
            ),
            Spacer(),
            Icon(
              Icons.arrow_forward_ios_sharp,
              size: 18,
              color: Color.fromRGBO(204, 204, 204, 1),
            ),
          ],
        ),
      ),
    );
  }

  ///黑名单
  Widget blackList() {
    return GestureDetector(
      onTap: () {
        print("----------------------黑名单--------------------");
        Navigator.push(context, MaterialPageRoute(builder: (context) {
          return BlacklistPage();
        }));
      },
      child: Container(
        width: MediaQuery.of(context).size.width - 32,
        height: 48,
        margin: EdgeInsets.only(left: 16, right: 16),
        child: Row(
          children: <Widget>[
            Text(
              "黑名单",
              style:
                  TextStyle(fontSize: 16, color: Color.fromRGBO(17, 17, 17, 1)),
            ),
            Spacer(),
            Icon(
              Icons.arrow_forward_ios_sharp,
              size: 18,
              color: Color.fromRGBO(204, 204, 204, 1),
            ),
          ],
        ),
      ),
    );
  }

  ///通知设置
  Widget notificationSettings() {
    return GestureDetector(
      onTap: () {
        print("----------------------通知设置--------------------");
        Navigator.push(context, MaterialPageRoute(builder: (context) {
          return NotificationSettingsPage();
        }));
      },
      child: Container(
        width: MediaQuery.of(context).size.width - 32,
        height: 48,
        margin: EdgeInsets.only(left: 16, right: 16, top: 12),
        child: Row(
          children: <Widget>[
            Text(
              "通知设置",
              style:
                  TextStyle(fontSize: 16, color: Color.fromRGBO(17, 17, 17, 1)),
            ),
            Spacer(),
            Icon(
              Icons.arrow_forward_ios_sharp,
              size: 18,
              color: Color.fromRGBO(204, 204, 204, 1),
            ),
          ],
        ),
      ),
    );
  }

  ///清除缓存
  Widget clearCache() {
    return GestureDetector(
      onTap: () {
        print("----------------------清除缓存--------------------");
      },
      child: Container(
        width: MediaQuery.of(context).size.width - 32,
        height: 48,
        margin: EdgeInsets.only(left: 16, right: 16),
        child: Row(
          children: <Widget>[
            Text(
              "清除缓存",
              style:
                  TextStyle(fontSize: 16, color: Color.fromRGBO(17, 17, 17, 1)),
            ),
            Spacer(),
            Icon(
              Icons.arrow_forward_ios_sharp,
              size: 18,
              color: Color.fromRGBO(204, 204, 204, 1),
            ),
          ],
        ),
      ),
    );
  }

  ///退出登录
  Widget logOut() {
    return GestureDetector(
      onTap: () {
        print("----------------------退出登录--------------------");
      },
      child: Container(
        width: MediaQuery.of(context).size.width - 32,
        height: 48,
        margin: EdgeInsets.only(left: 16, right: 16),
        child: Text(
          "清除缓存",
          style: TextStyle(fontSize: 16, color: Color.fromRGBO(255, 64, 89, 1)),
        ),
      ),
    );
  }
}
